package com.zretc.serviceimpl;

import java.util.List;

import com.zretc.dao.UsersDao;
import com.zretc.entity.Users;
import com.zretc.impl.UsersDaoImpl;
import com.zretc.service.UsersService;
import com.zretc.tools.PageData;

public class UsersServiceImpl implements UsersService {
      UsersDao ud=new UsersDaoImpl();
	@Override
	public boolean addUsers(Users u) {
		if(u==null) {
			return false;
		}
		if(ud.getUsersByUsername(u.getUsername()) != null) {
			return false;
		}
		boolean flag =ud.addUsers(u);
		return flag;
	}

	@Override
	public Users getUsersByUsername(String username) {
		// TODO Auto-generated method stub
		return ud.getUsersByUsername(username);
	}

	@Override
	public List<Users> getUsers(String keywords) {
		// TODO Auto-generated method stub
		return ud.getUsers("");
	}

	@Override
	public PageData<Users> getUsersByPage(int page, int pageSize, String keywords) {
		// TODO Auto-generated method stub
		if (page < 1) {
			page = 1;
		}
		return ud.getUsersByPage(page, pageSize, keywords);
	}

}
